<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="stylesheet" type="text/css" href="../static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="../lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="../static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="../static/h-ui/css/style.css" />
    <link rel="stylesheet" type="text/css" href="../lib/jqueryPage/paging.css" />
    <script type="text/javascript" src="../lib/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="../lib/layer/2.4/layer.js"></script>
    <script type="text/javascript" src="../static/h-ui/js/H-ui.min.js"></script>
    <script type="text/javascript" src="../static/h-ui.admin/js/H-ui.admin.js"></script>
    <script type="text/javascript" src="../lib/My97DatePicker/4.8/WdatePicker.js"></script>
    <script type="text/javascript" src="../lib/laypage/1.2/laypage.js"></script>
    <script src="../lib/jrender.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="../lib/jqueryPage/paging.min.js"></script>
    <script type="text/javascript" src="../lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
    <script src="../lib/jquery.validation/jquery.validate.min.js"></script>
    <script src="../lib/jquery.validation/messages_zh.js"></script>
    <script src="../lib/md5.js"></script>
    <script src="../js/config.js"></script>
    <title>代付设置</title>
</head>

<body>
    <nav class="breadcrumb">
        <i class="Hui-iconfont">&#xe67f;</i> 首页
        <span class="c-gray en">&gt;</span> 代付管理
        <span class="c-gray en">&gt;</span> 单个代付
        <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);"
            title="刷新">
            <i class="Hui-iconfont">&#xe68f;</i>
        </a>
    </nav>
    <div class="page-container">
        <div class="information">
            <form action="" id="commentForm" class="form form-horizontal">
                <!-- <table>
                    <tr>
                        <td>
                            <label for="orderNum">金额</label>
                        </td>
                        <td>
                            <input style="width:250px" class="input-text" name="orderNum" type="text" id="orderNum" required/>
                        </td>
                    </tr>
                    <tr>

                        <td>
                            <label for="payee_name">姓名</label>
                        </td>
                        <td>
                            <input style="width:250px" name="payee_name" class="input-text" type="text" id="payee_name" required/>
                        </td>
                        <td>
                            <label for="IDnumber">身份证号</label>
                        </td>
                        <td>
                            <input style="width:250px" name="IDnumber" class="input-text" type="text" id="IDnumber" required/>
                        </td>
                    </tr>
                    <tr>

                        <td>
                            <label for="payee_ba_bank_name">开户行名称</label>
                        </td>
                        <td>
                            <span class="select-box inline">
                                <select class="select" name="payee_ba_bank_name" id="payee_ba_bank_name" required>
                                    <option value="">请选择开户行</option>
                                    <option value="工商银行">工商银行</option>
                                    <option value="农业银行">农业银行</option>
                                    <option value="中国银行">中国银行</option>
                                    <option value="建设银行">建设银行</option>
                                    <option value="交通银行">交通银行</option>
                                    <option value="邮政储蓄银行">邮政储蓄银行</option>
                                    <option value="中信银行">中信银行</option>
                                    <option value="光大银行">光大银行</option>
                                    <option value="华夏银行">华夏银行</option>
                                    <option value="民生银行">民生银行</option>
                                    <option value="平安银行">平安银行</option>
                                    <option value="招商银行">招商银行</option>
                                    <option value="兴业银行">兴业银行</option>
                                    <option value="浦发银行">浦发银行</option>
                                    <option value="渤海银行">渤海银行</option>
                                    <option value="北京银行">北京银行</option>
                                    <option value="广发银行">广发银行</option>
                                    <option value="南京银行">南京银行</option>
                                    <option value="宁波银行">宁波银行</option>
                                    <option value="上海农商银行">上海农商银行</option>
                                    <option value="徽商银行">徽商银行</option>
                                    <option value="江苏银行">江苏银行</option>
                                    <option value="上海银行">上海银行</option>
                                    <option value="浙江银行">浙江银行</option>
                                    <option value="杭州银行">杭州银行</option>
                                    <option value="恒丰银行">恒丰银行</option>
                                    <option value="北京农商银行">北京农商银行</option>
                                    <option value="广州农商银行">广州农商银行</option>
                                    <option value="盛京银行">盛京银行</option>
                                    <option value="天津银行">天津银行</option>
                                    <option value="重庆农商银行">重庆农商银行</option>
                                    <option value="广东发展银行">广东发展银行</option>
                                    <option value="东亚银行">东亚银行</option>
                                    <option value="成都银行">成都银行</option>
                                    <option value="广州商业银行">广州商业银行</option>
                                    <option value="温州银行">温州银行</option>
                                </select>
                            </span>
                        </td>
                        <td>
                            <label for="bankcardnumber">银行卡号</label>
                        </td>
                        <td>
                            <input style="width:250px" class="input-text" name="bankcardnumber" type="text" id="bankcardnumber" required/>
                        </td>
                        <td>
                            <label for="cellphonenumber">预留手机号</label>
                        </td>
                        <td>
                            <input style="width:250px" class="input-text" name="cellphonenumber" type="text" id="cellphonenumber" required/>
                        </td>
                    </tr>

                    <tr>
                        <td>
                            <label for="openingbankaddress">开户行地址</label>
                        </td>
                        <td style="width:360px;" id="provinces-city">

                        </td>
                    </tr>

                    <tr>
                        <td>
                            <label for="remarks">备注</label>
                        </td>
                        <td>
                            <input style="width:250px" class="input-text" name="remarks" type="text" id="remarks" required/>
                        </td>
                        <td>
                            <label for="Payee_ba_type">账户类型</label>
                        </td>
                        <td>
                            <span class="select-box inline">
                                <select class="select" name="Payee_ba_type" id="Payee_ba_type" required>
                                    <option value="11">对私</option>
                                    <option value="12">对公</option>
                                </select>
                            </span>
                        </td>
                    </tr>
                    <tr style="text-align: center;">
                        <td colspan="6">
                            <button id="determine" class="btn btn-primary radius" type="submit">确定代付</button>
                        </td>
                    </tr>
                </table> -->

                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">
                        <span class="c-red">*</span>
                        代付金额：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" id="orderNum" placeholder="代付金额，单位(0.00元) 不低于10元" class="input-text" name="orderNum" min='10' required
                            number='true'>
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">
                        <span class="c-red">*</span>
                        开户行：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <select class="select" name="payee_ba_bank_name" id="payee_ba_bank_name" required>
                            <option value="">请选择开户行</option>
                            <option value="工商银行">工商银行</option>
                            <option value="农业银行">农业银行</option>
                            <option value="中国银行">中国银行</option>
                            <option value="建设银行">建设银行</option>
                            <option value="交通银行">交通银行</option>
                            <option value="邮政储蓄银行">邮政储蓄银行</option>
                            <option value="中信银行">中信银行</option>
                            <option value="光大银行">光大银行</option>
                            <option value="华夏银行">华夏银行</option>
                            <option value="民生银行">民生银行</option>
                            <option value="平安银行">平安银行</option>
                            <option value="招商银行">招商银行</option>
                            <option value="兴业银行">兴业银行</option>
                            <option value="浦发银行">浦发银行</option>
                            <option value="渤海银行">渤海银行</option>
                            <option value="北京银行">北京银行</option>
                            <option value="广发银行">广发银行</option>
                            <option value="南京银行">南京银行</option>
                            <option value="宁波银行">宁波银行</option>
                            <option value="上海农商银行">上海农商银行</option>
                            <option value="徽商银行">徽商银行</option>
                            <option value="江苏银行">江苏银行</option>
                            <option value="上海银行">上海银行</option>
                            <option value="浙江银行">浙江银行</option>
                            <option value="杭州银行">杭州银行</option>
                            <option value="恒丰银行">恒丰银行</option>
                            <option value="北京农商银行">北京农商银行</option>
                            <option value="广州农商银行">广州农商银行</option>
                            <option value="盛京银行">盛京银行</option>
                            <option value="天津银行">天津银行</option>
                            <option value="重庆农商银行">重庆农商银行</option>
                            <option value="广东发展银行">广东发展银行</option>
                            <option value="东亚银行">东亚银行</option>
                            <option value="成都银行">成都银行</option>
                            <option value="广州商业银行">广州商业银行</option>
                            <option value="温州银行">温州银行</option>
                        </select>
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">
                        <span class="c-red">*</span>
                        交易类型：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <select class="select" name="Payee_ba_type" id="Payee_ba_type" required>
                            <option value="11" selected>对私</option>
                            <option value="12">对公</option>
                        </select>
                    </div>
                </div>

                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">
                        <span class="c-red">*</span>
                        开户行地址：</label>
                    <div class="formControls col-xs-8 col-sm-9" id="provinces-city">

                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">
                        <span class="c-red">*</span>账户名称：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" id="payee_name" placeholder="账户名称" name="payee_name" class="input-text" required>
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">
                        <span class="c-red">*</span>银行卡号：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" id="payee_ba_mumber" placeholder="银行卡号" name="payee_ba_mumber" class="input-text" required>
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">
                        <span class="c-red">*</span>身份证号：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" id="payee_cert_no" placeholder="身份证号" name="payee_cert_no" class="input-text" required>
                    </div>
                </div>

                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">
                        <span class="c-red">*</span>手机号：</label>
                    <div class="formControls col-xs-8 col-sm-9">
                        <input type="text" id="payee_ba_mobile" placeholder="手机号" name="payee_ba_mobile" class="input-text" required>
                    </div>
                </div>
                <div class="row cl">
                    <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                        <button id="determine" class="btn btn-primary radius" type="submit">
                            确认代付</button>
                    </div>
                </div>
            </form>
        </div>
    </div>


</body>
<!-- 三级联动 -->
<script src="../lib/provincesCity/jquery.provincesCity.js"></script>
<script src="../lib//provincesCity/provincesData.js"></script>
<script>
    $.validator.setDefaults({
        submitHandler: function () {
            layer.prompt({
                title: '请输入登录密码，并确认',
                formType: 1
            }, function (pass, index) {
                layer.close(index);
                var index = layer.load(1, {
                    shade: [0.1, '#000'] //0.1透明度的白色背景
                });
                check_user(pass, function () {
                    // 处理代付
                    $need_sign_map = {
                        'userMerchantNo': $.userDaifu.userMerchantNo,
                        'payType': '2',
                        'uOrderNo': 'wydf' + (new Date()).valueOf() + parseInt(Math.random() *
                            (999999 - 100000 + 1) + 100000),
                        // 'retUrnUrl':$retUrnUrl,
                        'orderWater': 'wydf' + (new Date()).valueOf() + parseInt(Math.random() *
                            (999999 - 100000 + 1) + 100000),
                        'userPublicKey': $.userDaifu.userPublicKey,
                        'orderNum': $('#orderNum').val(),
                        'orderRemarks': '商家单独代付',
                        'orderTitle': '商家单独代付',
                        'payee_ba_bank_name': $('#payee_ba_bank_name').val(),
                        'payee_ba_type': $('#Payee_ba_type').val(),
                        'payee_ba_bank_area': $('#country').val(),
                        'payee_ba_bank_City': $('#province').val(),
                        'payee_name': $('#payee_name').val(),
                        'payee_cert_no': $('#payee_cert_no').val(),
                        'payee_ba_mumber': $('#payee_ba_mumber').val(),
                        'payee_ba_mobile': $('#payee_ba_mobile').val(),
                        'dfPayType': '2',
                        'userPrvice': $.userDaifu.userPrivate,
                    };
                    $sort = ['userMerchantNo',
                        'payType',
                        'dfPayType',
                        'uOrderNo',
                        'userPublicKey',
                        'userPrvice',
                        'orderNum',
                        'orderRemarks',
                        'orderWater',
                        'orderTitle',
                        'payee_ba_bank_name',
                        'payee_ba_type',
                        'payee_ba_bank_area',
                        'payee_ba_bank_City',
                        'payee_name',
                        'payee_cert_no',
                        'payee_ba_mumber',
                        'payee_ba_mobile'
                    ];
                    $str = '';
                    $.each($sort, function (key, val) {
                        $str = $str + '&' + val + '=' + $need_sign_map[val];
                    });
                    $str.substr(0, 1);
                    if ($str.substr(0, 1) == '&') $str = $str.substr(1);
                    $need_sign_map['encryption'] = $.md5($str);

                    $.ajax({
                        type: 'POST',
                        url: $.webConfig.basicUrl+'/chuyangPay/chuyangPay/ldDaiPay',
                        data: $need_sign_map,
                        dataType: "json",
                        success: function (data) {
                            layer.close(index);
                            layer.confirm(data['msc'], {
                                btn: ['是否刷新页面', '取消'] //按钮
                            }, function () {
                                location.replace(location.href);
                            }, function () {
                                
                            });
                        },
                        error: function (err) {
                            console.log(err);
                            layer.close(index);                            
                            layer.alert('服务器出小差！');
                        }
                    });
                }, function () {
                    layer.alert('密码错误');
                });
            });
        }
    });

    $(function () {
        // 初始化三级联动
        $("#provinces-city").ProvinceCity();

        var account = $.cookie('user__userName');
        var md5 = $.cookie('user__code');
        $.ajax({
            type: 'POST',
            url: $.webConfig.basicUrl + '/chuyangPay/user/getUserDBChuYangKey',
            data: {
                account: account,
                md5: md5,
            },
            dataType: "json",
            success: function (data) {
                if (data['code'] == 200) {
                    $.userDaifu = data['data'];
                } else {
                    layer.alert(data['msc']);
                }
            },
            error: function (err) {
                console.log(err);
            }
        });
        $("#commentForm").validate();
    })


    function check_user(pwd, successCall, errorCall) {
        var account = $.cookie('user__userName');
        $.ajax({
            type: 'POST',
            url: $.webConfig.basicUrl + '/chuyangPay/user/userLogin',
            data: {
                account: account,
                pwd: pwd
            },
            dataType: "json",
            success: function (data) {
                if (data['code'] == 200) {
                    successCall();
                } else {
                    errorCall();
                }
            },
            error: function (err) {
                layer.alert('不好意思，我们的服务器在开小差');
            }
        })
    }
</script>

</html>